package com.xcdh.trading.entity;

import com.baomidou.mybatisplus.annotation.OrderBy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.core.annotation.Order;

@Data
@TableName("hot_money") // 游资交易
public class HotMoneyTrc {

    @TableId
    private Long id;
    //交易日期
    @OrderBy(sort = 1)
    @TableField("trade_date")
    private String tradeDate;
    //股票代码
    @TableField("ts_code")
    private String tsCode;
    //股票名称
    @TableField("ts_name")
    private String tsName;
    //买入金额（元）
    @TableField("buy_amount")
    @OrderBy
    private Double buyAmount;
    //卖出金额（元）
    @OrderBy(isDesc = false , sort = 4)
    @TableField("sell_amount")
    private Double sellAmount;
    //净买卖（元）
    @OrderBy(sort = 3)
    @TableField("net_amount")
    private Float netAmount;

    @TableField(exist = false)
    public Double netAmountAbs ;
    //标签
    @TableField("tag")
    private String tag;
    //游资名称
    @TableField("hm_name")
    private String hmName;
    //关联机构
    @TableField("hm_orgs")
    private String hmOrgs;

    private Float price ;

    private Float pctChg = 0F;

    /**
     * 换手率（%）
     */
    private Float turnoverRate;

    /**
     * 量比
     */
    private Float volumeRatio;
    @OrderBy(sort = 2)
    private Integer nums;

    public Float getShowPrice(){
        if(pctChg < 0){
            return -price ;
        }
        return price ;
    }
    public Double getSellAmountAbs(){
        return sellAmount * -1 ;
    }
}
